package dev.alm.meituanservice.controller;

import dev.alm.meituanservice.common.Result;
import dev.alm.meituanservice.entity.Channel;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;

@RestController
@RequestMapping("channel")
@CrossOrigin
public class ChannelController {

    @GetMapping("list")
    public Result getChannelList() {
        ArrayList<Channel> channels = new ArrayList<>();
        for (int i = 1; i < 11; i++) {
            Channel channel = new Channel();
            channel.setId(i);
            channel.setName("频道" + i);
            channel.setColor("#" + Integer.toHexString(i * 10000));
            channel.setDescription("频道" + i + "描述");
            channels.add(channel);
        }
        Result r = new Result();
        r.setCode("200");
        r.setMessage("success");
        r.setData(channels);
        return r;
    }

}
